// MemberCardServiceImpl.java
package edu.suda.xsap.service.impl;

import edu.suda.xsap.entity.MemberCard;
import edu.suda.xsap.mapper.MemberCardMapper;
import edu.suda.xsap.service.MemberCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MemberCardServiceImpl implements MemberCardService {

    @Autowired
    private MemberCardMapper memberCardMapper;

    @Override
    public void save(MemberCard memberCard) {
        memberCardMapper.save(memberCard);
    }

    @Override
    public void delete(Long id) {
        memberCardMapper.delete(id);
    }

    @Override
    public MemberCard findById(Long id) {
        return memberCardMapper.findById(id);
    }

    @Override
    public List<MemberCard> findAll() {
        return memberCardMapper.findAll();
    }

    @Override
    public List<MemberCard> findMemberCardsByMemberId(Long memberId) {
        return memberCardMapper.findMemberCardsByMemberId(Math.toIntExact(memberId));
    }
}